package com.share.device.service.impl;

import java.util.List;
import com.share.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.share.device.mapper.CabinetMapper;
import com.share.device.domain.Cabinet;
import com.share.device.service.ICabinetService;

/**
 * 充电宝柜机Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-23
 */
@Service
public class CabinetServiceImpl implements ICabinetService 
{
    @Autowired
    private CabinetMapper cabinetMapper;

    /**
     * 查询充电宝柜机
     * 
     * @param id 充电宝柜机主键
     * @return 充电宝柜机
     */
    @Override
    public Cabinet selectCabinetById(Long id)
    {
        return cabinetMapper.selectCabinetById(id);
    }

    /**
     * 查询充电宝柜机列表
     * 
     * @param cabinet 充电宝柜机
     * @return 充电宝柜机
     */
    @Override
    public List<Cabinet> selectCabinetList(Cabinet cabinet)
    {
        return cabinetMapper.selectCabinetList(cabinet);
    }

    /**
     * 新增充电宝柜机
     * 
     * @param cabinet 充电宝柜机
     * @return 结果
     */
    @Override
    public int insertCabinet(Cabinet cabinet)
    {
        cabinet.setCreateTime(DateUtils.getNowDate());
        return cabinetMapper.insertCabinet(cabinet);
    }

    /**
     * 修改充电宝柜机
     * 
     * @param cabinet 充电宝柜机
     * @return 结果
     */
    @Override
    public int updateCabinet(Cabinet cabinet)
    {
        cabinet.setUpdateTime(DateUtils.getNowDate());
        return cabinetMapper.updateCabinet(cabinet);
    }

    /**
     * 批量删除充电宝柜机
     * 
     * @param ids 需要删除的充电宝柜机主键
     * @return 结果
     */
    @Override
    public int deleteCabinetByIds(Long[] ids)
    {
        return cabinetMapper.deleteCabinetByIds(ids);
    }

    /**
     * 删除充电宝柜机信息
     * 
     * @param id 充电宝柜机主键
     * @return 结果
     */
    @Override
    public int deleteCabinetById(Long id)
    {
        return cabinetMapper.deleteCabinetById(id);
    }
}
